package com.appkubes.mall.admin.application.store.controller;

import com.appkubes.cloud.config.params.paramCheck.ParamCheck;
import com.appkubes.common.Response;
import com.appkubes.mall.admin.application.store.entity.vo.StoreAuditVO;
import com.appkubes.mall.admin.application.store.entity.vo.StoreVO;
import com.appkubes.mall.core.controller.BaseMallStoreController;
import com.appkubes.mall.core.entity.MallStore;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;

@Slf4j
@Api(tags = "门店管理")
@RestController
@RequestMapping("/store")
public class StoreController extends BaseMallStoreController {
    @ApiOperation("门店列表")
    @GetMapping("/list")
    public Response list(@ParamCheck StoreVO storeVO) {
        MallStore queryEntity = new MallStore();
        BeanUtils.copyProperties(storeVO, queryEntity);
        IPage result = this.selectPageByEntity(queryEntity, storeVO);
        return Response.success(result);
    }


    @ApiOperation(value = "审核门店")
    @PostMapping("/audit")
    public Response audit(@RequestBody @ParamCheck StoreAuditVO storeAuditVO) {
        MallStore queryEntity = new MallStore();
        BeanUtils.copyProperties(storeAuditVO, queryEntity);
        Boolean ret = this.updateById(queryEntity);
        return Response.success(ret);
    }

}
